{% extends "base.html" %}
{% from "macros/widgets.html" import module_icon_lock %}
{% from "macros/widgets.html" import card %}

{% block content %}
<div class="jumbotron">
    <div class="container">
    <h2 class="row">请神奇宝贝训练家前往本道馆的前置神奇宝贝道馆学习与挑战！</h2>
    </div>
</div>

<div class="container">

  
  <div class="row">
    <img src="/themes/dojo_theme/static/img/dojo/deteat.png" style="width: 500px;">
  </div>

  <br><br>

  <h2 class="row">前置神奇宝贝道馆</h2>

  <ul class="card-list">
    {% for dojo in prerequisite_dojo_sub %}
    {{ card(url_for("pwncollege_dojos.view_dojo", dojo=dojo.reference_id),
    title=dojo.name or dojo.id,
    text="{} Modules : ".format(dojo.modules | length) + "{} / {}".format(dojo.solves(user=user, ignore_visibility=True, ignore_admins=False).count() if user else 0, dojo.challenges | length),
    icon="/themes/dojo_theme/static/img/dojo/{}.svg".format(dojo.award.emoji) if (dojo.award.emoji and dojo.official) else None) }}
  {% endfor %}
</ul>
  <br><br>

  <h2 class="row">道馆模块</h2>
  <br>
  <ul class="card-list">
    {% for module in dojo_locked.modules %}
    <a class="text-decoration-none">
      {# TODO: card-active, card-hidden #}
      <li class="card card-small">
        <div class="card-body">
          <h4 class="card-title">{{ module.name or module.id }}</h4>
            {% if module.data.icon %}
            {{ module_icon_lock(icon="/themes/dojo_theme/static/img/dojo/{}.svg".format(module.data.icon) if (module.data.icon) else None) }}  
            {% endif %}
          <p class="card-text">
            {{ module.solves(user=user, ignore_visibility=True, ignore_admins=False).count() if user else 0 }} / {{ module.visible_challenges() | length }}
          </p>
        </div>
      </li>
    </a>
    {% endfor %}

</div>
{% endblock %}

{% block scripts %}
<script defer onload="loadScoreboard(0, 1);" src="{{ url_for('views.themes', path='js/dojo/scoreboard.js') }}"></script>
<script defer src="{{ url_for('views.themes', path='js/dojo/copy.js') }}"></script>
{% endblock %}
